<template>
  <div>
    <YlSelect
      size="small"
      :multiple="false"
      :filterable="true"
      :options="options"
      @value-change="getValueChange"
    ></YlSelect>
  </div>
</template>

<script>
export default {
  data () {
    return {
      options: []
    }
  },
  created () {
    this.getDepart()
  },
  methods: {
    async getDepart () {
      let data = await this.$ylapi.getAllDepart()
      let arr = []
      for (let i in data) {
        arr.push({
          value: data[i],
          label: data[i]
        })
      }
      this.options = arr
    },

    getValueChange (val) {
      console.log(val)
    }
  }
}
</script>
